import 'package:flutter/material.dart';
import 'package:flutter_module/global/colors.dart';
import 'package:flutter_screenutil/screen_util.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        //appBar: AppBar(
        //  backgroundColor: Colors.black26,
        //  title: Text('container'),
        //),
        body: MyNFT(),
      ),
    );
  }
}
class MyNFT extends StatefulWidget {
  MyNFT({Key key}) : super(key: key);

  @override
  _MyNFTState createState() {
    return _MyNFTState();
  }
}

class _MyNFTState extends State<MyNFT> {
  final List<Widget> _tabs = [
    Tab(text: "待售出"),
    Tab(text: "已下架"),
    Tab(text: "审核中"),
  ];
  final List<Widget> _tabViews = [
    Text('针推'),
    Text('护理学'),
    Text('护理学'),
  ];
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(
      BoxConstraints(
          maxWidth: MediaQuery.of(context).size.width,
          maxHeight: MediaQuery.of(context).size.height
      ),
      designSize: Size(1080,2340),
    );
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xff000B1F),
        title: Text(
          '我的NFT',
          style:TextStyle(
            color:Colors.white,
          ),
        ),
        centerTitle: true,
        leading: IconButton(
          icon: Icon(Icons.arrow_back,color: Colors.white),
          onPressed: (){
            Navigator.pop(context);
          },
        ),
      ),
      backgroundColor:Color(0xff000B1F) ,
      body: Container(
        color: Color(0xff000B1F),
        child: DefaultTabController(
          length: _tabs.length,
          child: Scaffold(
            backgroundColor: Color(0xff000B1F),
            appBar: _tabBar(),
            body: TabBarView(
              children: _tabViews,
            ),
          ),
        ),
      ),
    );
  }
  Widget _tabBar() {
    return TabBar(
      tabs: _tabs,
      labelColor: AppColors.primary,
      labelStyle: TextStyle(
          fontWeight: FontWeight.bold,
          fontSize: ScreenUtil().setSp(45),
          fontFamily: '方正御墨行书'),
      unselectedLabelColor: Colors.white,
      unselectedLabelStyle:
      TextStyle(fontSize: ScreenUtil().setSp(40), fontFamily: '方正御墨行书'),
      indicatorSize: TabBarIndicatorSize.tab,
      indicatorColor: AppColors.primary,
      indicatorWeight: 4,
      isScrollable: true,
    );
  }
}